
CXX    = g++
CFLAGS = -Wall -g -fprofile-arcs -ftest-coverage  

ifeq ($(shell uname), Darwin)
    LIBS = -framework GLUT -framework OpenGL -framework Cocoa
else
    LIBS = -lglut -lGL -lGLU 
endif

GLUI = /afs/nd.edu/coursefa.12/cse/cse40166.01
ifneq "$(wildcard $(GLUI))" ""
    INCPATH += -I$(GLUI)/include
    LIBPATH += -L$(GLUI)/lib
endif

FREEGLUT = /afs/nd.edu/user37/ccl/software/external/freeglut
ifneq "$(wildcard $(FREEGLUT))" ""
    INCPATH += -I$(FREEGLUT)/include
    LIBPATH += -L$(FREEGLUT)/lib
endif

GLEW =/home/felix/cse232fa13/external/glew-1.9.0
ifneq "$(wildcard $(GLEW))" ""
    INCPATH += -I$(GLEW)/include
    LIBPATH += -L$(GLEW)/lib -Wl,--rpath -Wl,$(GLEW)/lib
endif


all: testGraphics 

clean:
	rm -f *.o testGraphics

depend:
	rm -f Makefile.bak
	mv Makefile Makefile.bak
	sed '/^# DEPENDENCIES/,$$d' Makefile.bak > Makefile
	echo '# DEPENDENCIES' >> Makefile
	$(CXX) -MM *.cpp >> Makefile

.c.o: 	
	$(CXX) $(CFLAGS) $(INCPATH) -c -o $@ $<

.cc.o: 	
	$(CXX) $(CFLAGS) $(INCPATH) -c -o $@ $<

.cpp.o: 	
	$(CXX) $(CFLAGS) $(INCPATH) -c -o $@ $<

testGraphics: testGraphics.o Graphics.o Situation.o Player.o Room.o
	$(CXX) $(CFLAGS) $(INCPATH) -o $@ $^ $(LIBPATH) $(LIBS)

Graphics.o: Graphics.cpp
	g++ $(CFLAGS) -c Graphics.cpp

Situation.o:	../situationControl/Situation.cpp
	g++ $(CFLAGS) -c ../situationControl/Situation.cpp

Player.o:	../situationControl/Player.cpp
	g++ $(CFLAGS) -c ../situationControl/Player.cpp

Room.o:	../situationControl/Room.cpp 
	g++ $(CFLAGS) -c ../situationControl/Room.cpp
 
# DEPENDENCIES
testGraphics.o: testGraphics.cpp Graphics.h ../situationControl/Situation.h ../situationControl/Player.h ../situationControl/Room.h 
